#include "timer_cleaner.h"

// Thread that will every second delete the RSSI older than a second
void * cleaner() {
    struct timeval current;

    while (1) {
        sleep(1);

        sem_wait(&list_protect);
        gettimeofday(&current, NULL);
        delete_outdated(dl, current);
        sem_post(&list_protect);

	// For debugging : prints all the mac address already detected with the 
	// corresponding RSSIs
        //sem_wait(&list_protect);
        //print_lists(dl);
        //printf("\n\n");
        //sem_post(&list_protect);
    }
}
